
  
  <template>
  <div>
    <el-card>
      <template #header>
        <div class="card-header flex">
          <div class="flex1">用户列表</div>
          <el-button type="primary" @click="toEditPage()">新建用户</el-button>
        </div>
      </template>

      <el-table :data="list" :loading="loading">
        <el-table-column label="序号" align="center" prop="_index" />
        <el-table-column label="用户姓名" align="center" prop="realName">
        </el-table-column>
        <el-table-column label="手机号" align="center" prop="phone">
        </el-table-column>
        <el-table-column label="是否可用" align="center" prop="status">
          <template #default="scope">
            <tag :value="scope.row.status" type="status"></tag>
          </template>
        </el-table-column>
        <el-table-column
          label="创建人"
          align="center"
          prop="createByName"
        ></el-table-column>

        <el-table-column
          label="创建时间"
          width="200px"
          align="center"
          prop="createTime"
        >
        </el-table-column>

        <el-table-column
          label="操作"
          fixed="right"
          align="center"
          width="120px"
        >
          <template #default="scope">
            <el-button
              link
              type="primary"
              @click="toEditPage(scope.row.userId)"
              v-hasPermi="['infra:config:update']"
            >
              编辑
            </el-button>
            <!-- <el-button
              link
              type="danger"
              @click="handleDelete(scope.row.id)"
              v-hasPermi="['infra:config:delete']"
            >
              删除
            </el-button> -->
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
  
<script setup lang="ts">
import API from '@/api/api';
import { CONST_VALUE } from '@/utils/const';
import { useListPage } from '@/hooks/useListPage';
const router = useRouter();
const {
  queryParams,
  queryFormRef,
  loading,
  list,
  handleQuery,
  resetQuery,
  handleDelete,
} = useListPage({
  queryApi: API.sysUserController.getlist,
});

function toEditPage(id?: number) {
  router.push({
    name: 'editUser',
    query: {
      id,
    },
  });
}
</script>